package com.example.ziru.service.impl;

import com.example.ziru.entity.ConsultSee;
import com.example.ziru.mapper.ConsultSeeMapper;
import com.example.ziru.mapper.RoomsMapper;
import com.example.ziru.service.ConsultSeeService;
import com.example.ziru.service.RoomsService;
import com.example.ziru.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ConsultSeeServiceImpl implements ConsultSeeService {
    @Autowired
    private RoomsMapper roomsMapper;

    @Autowired
    private ConsultSeeMapper consultSeeMapper;
    @Override
    public Object addConsult(Integer roomId, String seeTime, String seePhone) {
        int uid = roomsMapper.queryRoomsById(roomId).getUid();
        ConsultSee consultSee = new ConsultSee();
        consultSee.setUid(uid);
        consultSee.setSeeTime(seeTime);
        consultSee.setRoomId(roomId);
        consultSee.setSeePhone(seePhone);
        if(consultSeeMapper.addConsult(consultSee) == 0){
            return new Result("-1","数据库插入失败",null);
        }
        return new Result("200","成功",null);
    }
}
